package com.tuanzi.loan.business.service.family.impl;

import com.tuanzi.loan.business.entity.family.LoanLargeAmountGongZhongUserInfo;
import com.tuanzi.loan.business.repository.family.LoanLargeAmountGongZhongUserInfoRepository;
import com.tuanzi.loan.business.service.family.LoanLargeAmountGongZhongUserInfoService;
import com.tuanzi.loan.core.aspect.Debug;
import com.tuanzi.loan.core.service.CommonServiceImpl;
import com.tuanzi.loan.core.vo.PageSearcher;
import com.tuanzi.loan.vo.request.family.largeamount.LoanLargeAmountGzhRequest;
import com.tuanzi.loan.vo.response.family.largeamount.LoanLargeAmountGzhResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.retry.RetryException;
import org.springframework.retry.annotation.Retryable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * User: liangZongXi
 * Create time: 10:08 2019/3/29
 * Description:
 */

@Debug
@Service
@Transactional
@Retryable(value = { RetryException.class })
public class LoanLargeAmountGongZhongUserInfoServiceImpl extends CommonServiceImpl<LoanLargeAmountGongZhongUserInfo, Long> implements LoanLargeAmountGongZhongUserInfoService {

    private final LoanLargeAmountGongZhongUserInfoRepository loanLargeAmountGongZhongUserInfoRepository;

    @Autowired
    public LoanLargeAmountGongZhongUserInfoServiceImpl(LoanLargeAmountGongZhongUserInfoRepository loanLargeAmountGongZhongUserInfoRepository) {
        this.loanLargeAmountGongZhongUserInfoRepository = loanLargeAmountGongZhongUserInfoRepository;
    }

    @Override
    public Page<LoanLargeAmountGzhResponse> list(PageSearcher<LoanLargeAmountGzhRequest> pageSearcher) {
        return loanLargeAmountGongZhongUserInfoRepository.list(pageSearcher.getSearchCondition(), pageSearcher.getPageable());
    }

    @Override
    public LoanLargeAmountGzhResponse findUserInfoAndUserAppyByUserInfoId(Long userInfoId) {
        return loanLargeAmountGongZhongUserInfoRepository.findUserInfoAndUserAppyByUserInfoId(userInfoId);
    }

    @Override
    protected JpaRepository<LoanLargeAmountGongZhongUserInfo, Long> getRepository() {
        return loanLargeAmountGongZhongUserInfoRepository;
    }
}
